//26. 删除有序数组中的重复项 https://leetcode.cn/problems/remove-duplicates-from-sorted-array/description/
#include<vector>
using namespace::std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int n = nums.size();
        if (n == 0)
            return 0;
        int fast = 1,slow = 1;
        while (fast < n)
        {
            if (nums[fast-1] != nums[fast])
            {
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;

};
};
//这题关键在于要原地修改，所以使用快慢指针，fast不重复就把元素放到slow的位置，最后只剩slow,因为题目说了不用管后面的元素